/*
 * clog_level.h
 *
 *  Created on: 2012-8-18
 *      Author: lin
 */

#ifndef CLOG_LEVEL_H_
#define CLOG_LEVEL_H_

#include "def/defs.h"
#include "zmalloc/zmalloc.h"

#define CLOG_MAX_LEVEL 64

typedef struct {
    uint16_t level;
    uint16_t syslog_level;
    //name_len *2 = strlen(str)
    //str = 'INFOinfo',name='info'
    uint16_t strlen;
    char str[0];
} clog_level_t;

clog_level_t *clog_level_new(uint16_t level, uint16_t syslog_levle,
        const char* name);
static inline void clog_level_free(clog_level_t *level) {
    zfree(level);
}

clog_level_t *clog_level_dup(clog_level_t *level);

#define clog_level_name_upcase(level) (level)->str
#define clog_level_name_lowcase(level) (level)->str+ (level)->strlen
#endif /* CLOG_LEVEL_H_ */
